<?php
namespace api\tv\controller;

use think\Config;
use think\Request;
use cms\Controller;
use cms\Response;
use app\common\App;

class Base extends Controller
{
    public function _initialize(){
        header('Access-Control-Allow-Origin:*');  
    }

    public function api($code, $message = '', $data = [])
    {
        Response::getInstance()->json([
            'code' => $code,
            'message' => $message,
            'data' => $data
        ]);
    }

    public function version()
    {
        $data['version'] = Config::get('app_version');
        $data['url'] = Config::get('app_download');
        return $this->api(200, 'success', $data);
    }
}
 